import React,{Component} from 'react';
import {Route, Link} from 'react-router-dom';

class News extends Component {
    constructor(props) {
        super(props);
        this.state = {  };
    }
    componentDidMount(){
        console.log(this.props.routes)
    }
    render() {
        return (
            <div>
                <div className="content">
                    <div className="left">
                        <Link to={this.props.routes[0].path}>NewsAdd</Link>
                        <br/>
                        <Link to={this.props.routes[1].path}>NewsList</Link>
                    </div>
                    <div className="right">
                        {
                            this.props.routes.map((route,key)=>{
                                return <Route exact key={key} path={route.path} component={route.component}/>
                            })
                        }
                    </div>
                </div>
            </div>
        );
    }
}

export default News;